package com.sc.nft.service.impl;

import com.sc.nft.dao.ServiceCenterAuditDao;
import com.sc.nft.dao.SupplementarySignatureFrequencyDao;
import com.sc.nft.entity.SupplementarySignatureFrequency;
import com.sc.nft.entity.dto.ActivityAwardSaveDTO;
import com.sc.nft.entity.dto.SupplementarySignatureDTO;
import com.sc.nft.entity.vo.SupplementarySignatureVO;
import com.sc.nft.service.SupplementarySignatureFrequencyService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@RequiredArgsConstructor
@Service
public class SupplementarySignatureFrequencyServiceImpl implements SupplementarySignatureFrequencyService {

    private final SupplementarySignatureFrequencyDao supplementarySignatureFrequencyDao;


    @Override
    public void save(List<SupplementarySignatureDTO> supplementarySignatureDTOS, Long activityBasicsId) {
        supplementarySignatureDTOS.forEach(supplementarySignatureDTO -> {
            SupplementarySignatureFrequency supplementarySignatureFrequency = new SupplementarySignatureFrequency();
            supplementarySignatureFrequency.setActivityBasicsId(activityBasicsId);
            supplementarySignatureFrequency.setPropId(supplementarySignatureDTO.getSupplementarySignaturePropId());
            supplementarySignatureFrequency.setConsumeNumber(supplementarySignatureDTO.getSupplementarySignaturePropNumber());
            supplementarySignatureFrequency.setSupplementarySignatureFrequency(supplementarySignatureDTO.getSupplementarySignaturePropCount());
            supplementarySignatureFrequency.insert();
        });
    }

    /**
     * 根据活动Id获取补签配置内容
     * @param activityBasicsId
     * @return
     */
    @Override
    public List<SupplementarySignatureVO> getByActivityBasicsId(Long activityBasicsId) {
        return supplementarySignatureFrequencyDao.getByActivityBasicsId(activityBasicsId);
    }
}
